home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung 2 / Power-Programmierung CD 2 (Tewi)(1994).iso / c / library / dos / diverses / tctnt / cmacros.tem < prev    next >
Encoding:
Text File  |  1991-08-27  |  5.4 KB  |  192 lines

  1. /******************************************************************
  2.  
  3. INTRODUCTION TO TEMC:
  4.  
  5. TEMC, Turbo Editor Macro Compiler, is an editor macro compiler for the
  6. IDE. It processes a script file that defines editor macros and key
  7. bindings, and produces a configuration file that is read by the IDE to
  8. define the effects of keyboard commands in the editor.  The script language
  9. used with TEMC is TEML, Turbo Editor Macro Language.  TEML is a
  10. simple yet power language which allows detailed customization of the IDE
  11. editor.
  12.  
  13. ******************************************************************/
  14.  
  15. /******************************************************************
  16. This file contains a TEML script that is helpful to C and C++
  17. programmers.  To use the macros in this file run TEMC to compile
  18. it and add it to the appropriate tcconfig.tc file.  The syntax for
  19. this is:
  20.  
  21. TEMC cmacros.tem tcconfig.tc
  22.  
  23. This will add the macros and key definitions in cmacros.tem to what
  24. already exists in tcconfig.tc.
  25.  
  26. For more information on TEMC, please refer to the file UTIL.DOC.
  27.  
  28. ******************************************************************/
  29.  
  30. /******************************************************************
  31.  
  32. Macro:   Sample macro to comment a function
  33.  
  34. Use:     Put the cursor immediately after a function name which is
  35.          at the left of the screen, then press Alt-T
  36.  
  37. ******************************************************************/
  38.  
  39. macro MakeFuncText
  40.     InsertText("\n\n");            /* add white space */
  41.     CursorUp;
  42.     CursorUp;
  43.     LeftOfLine;                    /* go before beginning of intended
  44.                                       function name */
  45.     SetBlockBeg;                   /* mark function name */
  46.     WordRight;
  47.     SetBlockEnd;
  48.     LeftOfLine;
  49.     CursorDown;
  50.     CopyBlock;                     /* copy for prototyping */
  51.     CursorUp;
  52.     LeftOfLine;
  53.     InsertText("\nFunction: ");     /* add "Function" to comment area */
  54.     RightOfLine;
  55.     CursorUp;                      /* put in comment lines before and
  56.                       after */
  57.     LeftOfLine;
  58.     InsertText("/*******************************************************");
  59.     CursorDown;
  60.     RightOfLine;
  61.     InsertText("\n\n");
  62.     LeftOfLine;
  63.     InsertText("Description:\n");
  64.     LeftOfLine;
  65.     InsertText("*******************************************************/\n");
  66.     CursorDown;                     /* go back to end of name */
  67.     RightOfLine;
  68. end;                                /* MakeFuncText */
  69.  
  70. /*******************************************************************
  71.  
  72. MACRO: MakeStub
  73.  
  74. DESCRIPTION:  Creates a stub, based on a user-entered function name.
  75.    It assumes the cursor is positioned immediately after the name,
  76.    and the name is at the left of the screen.
  77.  
  78. *******************************************************************/
  79.  
  80. macro MakeStub
  81.     LeftOfLine;           /* go before beginning of intended
  82.                 function name */
  83.     InsertText("void ");  /* void return type */
  84.     RightOfLine;
  85.     InsertText("( void )\n{\n");  /* void parameter */
  86.     InsertText("printf(\"This is ");
  87.     CursorUp;
  88.     CursorUp;
  89.     LeftofLine;
  90.     WordRight;
  91.     SetBlockBeg;
  92.     WordRight;
  93.     CursorLeft;
  94.     CursorLeft;
  95.     SetBlockEnd;
  96.     CursorDown;
  97.     CursorDown;
  98.     RightofLine;
  99.     InsertText(" ");
  100.     CopyBlock;
  101.     SetBlockBeg;
  102.     SetBlockEnd;
  103.     RightofLine;
  104.     InsertText("\\n\");");
  105.     InsertText("\n}");
  106. end;
  107.  
  108. /*******************************************************************
  109.  
  110. MACRO: MakeComment
  111.  
  112. DESCRIPTION:  Inserts comment bars
  113.  
  114. *******************************************************************/
  115.  
  116. macro MakeComment
  117.    InsertText("/******************************");
  118.    InsertText("*************************************\n\n");
  119.    InsertText("*******************************");
  120.    InsertText("************************************/\n");
  121.    CursorUp;
  122.    CursorUp;
  123. end;
  124.  
  125. /*******************************************************************
  126.  
  127. MACRO: MakeMain
  128.  
  129. DESCRIPTION:  Inserts outline of main program
  130.  
  131. *******************************************************************/
  132.  
  133. macro MakeMain
  134.    InsertText("int main(void)\n{\n\n  return 0;\n");
  135.    LeftOfLine;
  136.    InsertText("}");
  137.    CursorUp;
  138.    CursorUp;
  139.    CursorRight;
  140. end;
  141.  
  142. /*******************************************************************
  143.  
  144. MACRO: MainCppIO
  145.  
  146. DESCRIPTION:  Inserts outline of main program for C++ which uses
  147.    iostream.h.
  148.  
  149. *******************************************************************/
  150.  
  151. macro MainCppIO
  152.    InsertText("#include <iostream.h>\n\n");
  153.    InsertText("int main(void)\n{\n\n  return 0;\n");
  154.    LeftOfLine;
  155.    InsertText("}");
  156.    CursorUp;
  157.    CursorUp;
  158.    CursorRight;
  159. end;
  160.  
  161. /*******************************************************************
  162.  
  163. MACRO: MainCIO
  164.  
  165. DESCRIPTION:  Inserts outline of main program for C which uses
  166.   stdio.h
  167.  
  168. *******************************************************************/
  169.  
  170. macro MainCIO
  171.    InsertText("#include <stdio.h>\n\n");
  172.    InsertText("int main(void)\n{\n\n  return 0;\n");
  173.    LeftOfLine;
  174.    InsertText("}");
  175.    CursorUp;
  176.    CursorUp;
  177.    CursorRight;
  178. end;
  179.  
  180. /*******************************************************************
  181.  
  182. KEYBOARD ASSIGNMENTS:
  183.  
  184. *******************************************************************/
  185.  
  186. Alt-T : MakeFuncText;
  187. Alt-I : MakeStub;
  188. Alt-B : MakeComment;
  189. Alt-M : MainCppIO;
  190. Alt-N : MainCIO;
  191. Alt-Y : MakeMain;
  192.